/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package transervfx.Dato.Entidad;

import java.io.Serializable;
import javafx.beans.property.adapter.JavaBeanIntegerProperty;
import javafx.beans.property.adapter.JavaBeanIntegerPropertyBuilder;
import javafx.beans.property.adapter.JavaBeanStringProperty;
import javafx.beans.property.adapter.JavaBeanStringPropertyBuilder;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Range;
import transervfx.Dato.Validacion.ValidacionesNivelLogico;


/**
 *
 * @author oscar
 */
@Entity
//@DiscriminatorValue("J")

@NamedQueries({
    @NamedQuery( name = "Juridico.findAll", query = "SELECT c FROM Juridico c"),
    @NamedQuery( name = "Juridico.findByCuit", query = "SELECT c FROM Juridico c WHERE c.cuit = :cuit"),
    @NamedQuery( name = "Juridico.findByRazonSocial", query = "SELECT c FROM Juridico c WHERE c.razonSocial = :razonSocial"),
    //@NamedQuery( name = "Juridico.findByRazonSocialAndCuit", query = "SELECT r FROM Juridico r WHERE (r.razonSocial = :razonSocial) AND (r.cuit = :cuit)")
    
})
public class Juridico extends Cliente implements Serializable {

    private static final long serialVersionUID = 1L;
    
    
    
    @NotNull(message = "Obligatorio", groups = ValidacionesNivelLogico.class)
    @NotEmpty(message = "Completar", groups = ValidacionesNivelLogico.class)
    @Size(min = 2, max = 30, message = "2 letras minimos, 30 maximo", groups = ValidacionesNivelLogico.class)
    private String razonSocial;
 
    //-------------------propiedades binding
    @Transient
    private JavaBeanStringProperty PROP_RAZONSOCIAL;
    
    public Juridico() {
    }

    public Juridico(String razonSocial) {
        this.razonSocial = razonSocial;
    }

    public String getRazonSocial() {
        return razonSocial;
    }

    public void setRazonSocial(String razonSocial) {
        this.razonSocial = razonSocial;
    }
 
  
     @Override
    public String toString() {
        return  razonSocial;
    }
    
     public JavaBeanStringProperty getPROP_RAZONSOCIAL() throws NoSuchMethodException {
        if (PROP_RAZONSOCIAL == null) {
            PROP_RAZONSOCIAL = JavaBeanStringPropertyBuilder.create().bean(this).name("razonSocial").build();
            getGroupBindProperties().add(PROP_RAZONSOCIAL);
        }
        return PROP_RAZONSOCIAL;
    }

   
}
